#pragma once
#include "Point.h"
#include <vector>
#include "OrderEnum.h"

using std::vector;

class Quadrature
{
public:
	Quadrature();
	~Quadrature();

	size_t size() { return _points.size(); }

	vector<Point> _points;
	vector<double> _weights;
};

Quadrature::Quadrature()
{
}

Quadrature::~Quadrature()
{
}

class QGauss : public Quadrature
{
public:
	QGauss(size_t dim, Order order);
	~QGauss();

private:

};

QGauss::QGauss(size_t dim, Order order):
	Quadrature()
{
	switch (order)
	{
	case CONSTANT:
	case FIRST:
	{
		_weights = { 2.0 };
		_points = { Point(0,0,0) };
		return;
	}
	case SECOND:
	case THIRD:
	{
		_points.resize(2);
		_weights.resize(2);

		_points[0](0) = double(-5.7735026918962576450914878050196e-01L); // -sqrt(3)/3
		_points[1] = -_points[0];

		_weights[0] = 1.;
		_weights[1] = _weights[0];
		return;
	}
	case FOURTH:
	case FIFTH:
	{
		_points.resize(3);
		_weights.resize(3);

		_points[0](0) = double(-7.7459666924148337703585307995648e-01L);
		_points[1](0) = 0.;
		_points[2] = -_points[0];

		_weights[0] = double(5.5555555555555555555555555555556e-01L);
		_weights[1] = double(8.8888888888888888888888888888889e-01L);
		_weights[2] = _weights[0];

		return;
	}
	default:
		break;
	}
}

QGauss::~QGauss()
{
}